#include<stdio.h>
#include<stdlib.h>
#include<dirent.h>
#include<unistd.h>

int main(int argc, char* argv[]) {
    if(argc < 2){
        printf("Usage: %s <directory>\n", argv[0]);
        exit(1);
    }

    DIR * dir_stream = opendir(argv[1]);
    if(dir_stream == NULL){
        perror("opendir");
        exit(1);
    }

    struct dirent* file_info;
    while((file_info = readdir(dir_stream)) != NULL){
        printf("%s\n", file_info->d_name);
    }

    closedir(dir_stream);
    return 0;
}